<?php

class Elementosform {

    static function select(array $arr,$name,$class,$val = NULL) {
        $ele = '<select name="'.$name.'" class="'.$class.'">';
        foreach ($arr as $key => $value){ 
            $selected = '';
            if($key == $val) $selected = 'selected';
            $ele .= '<option value="'.$key.'" '.$selected.'>'.$value.'</option>';     
        }
        $ele .= '</select>';
        return $ele;
    }
    
}